package cn.itcast.recorddao;

import cn.itcast.domain.Record;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RecordRepository extends JpaRepository<Record,Integer>,
        JpaSpecificationExecutor<Record> {

    //按月份查询
    @Query(value = "select * from T_RECORD t where to_char(DateTime,'YYYY/MM') = ? ",nativeQuery=true)
    @Modifying
  public List<Record>  findByMonth(String month);
    
    //按日期查询
    @Query(value = "select * from T_RECORD t where to_char(DateTime,'YYYY/MM/dd') = ?",nativeQuery=true)
    @Modifying
  public Record  findByDay(String day);

    
}
